home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 41.zip
/
BS1 part 41
/
Abacus diskdrives IO.adf
/
CH5
/
fullassign.c
< prev
next >
Wrap
C/C++ Source or Header
|
1978-06-28
|
3KB
|
143 lines
/*-----------------------------------------------------*/
/* ASSIGN-Function for AmigaDOS */
/* */
/* JEA, 18-08-87 */
/*-----------------------------------------------------*/
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <libraries/filehandler.h>
extern struct DosLibrary *DOSBase;
UBYTE *dtl_types[] = {
"Device : ",
"Directory: ",
"Volume : "
};
/*-----------------------------------------------------*/
/* Convert BSTR into C-String */
/* */
/* */
/*-----------------------------------------------------*/
BstrC( bstr, buf )
BSTR *bstr;
UBYTE *buf;
{
UBYTE *str;
LONG loop;
LONG counter;
counter = 0;
str = (UBYTE*) BADDR( bstr );
for( loop = (LONG) str[0]; loop--; ++counter){
buf[counter] = str[counter+1];
}
buf[counter] = 0;
}
/*-----------------------------------------------------*/
/* output BPTR-String */
/* */
/* */
/*-----------------------------------------------------*/
BstrOut( bstr )
BSTR *bstr;
{
UBYTE buf[80];
BstrC( bstr, buf );
printf( buf );
}
/*-----------------------------------------------------*/
/* Output ASSIGN Entries */
/* */
/* */
/*-----------------------------------------------------*/
FindeAssign()
{
struct RootNode *rootnode;
struct DosInfo *dosinfo;
struct DeviceList *devicelist;
struct FileLock *filelock;
rootnode = (struct RootNode*) DOSBase->dl_Root;
dosinfo = (struct DosInfo*) BADDR( rootnode->rn_Info );
devicelist = (struct DeviceList*) BADDR( dosinfo->di_DevInfo );
while( devicelist->dl_Next ){
printf( dtl_types[devicelist->dl_Type] );
BstrOut( devicelist->dl_Name );
printf( "\n" );
devicelist = (struct DeviceList*) BADDR( devicelist->dl_Next );
}
}
/*-----------------------------------------------------*/
/* Main program */
/* */
/* */
/*-----------------------------------------------------*/
main()
{
FindeAssign();
}